<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   Python正则表达式指南  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/563.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466460597: Accept with keywords: (title(0.4):Python,正则表达式,社区,数盟,指南, topn(0.333333333333):社区,数盟,信息,编译,查找,表达式,示例,Python,形式,模式,对象,例子,参数,斜杠,文章,默认值,方法,属性,子串,正则表达式,编号,语法,实例,字符串,字符,编程语言,数量词,模块,无法,文本).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    Python正则表达式指南
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    Python正则表达式指南 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,60] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/devl">
       编程语言
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/563.html">
          Python正则表达式指南
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,460 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/devl" rel="category tag">
          编程语言
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        本文介绍了Python对于正则表达式的支持，包括正则表达式基础以及Python正则表达式标准库的完整介绍及使用示例。本文的内容不包括如何编写高效的正则表达式、如何优化正则表达式，这些主题请查看其他教程。
       </p>
       <p>
        注意：本文基于Python2.4完成；如果看到不明白的词汇请记得百度谷歌或维基，whatever。
       </p>
       <p>
        尊重作者的劳动，转载请注明作者及原文地址 &gt;.&lt;
       </p>
       <h2 style="color: #000000;">
        1. 正则表达式基础
       </h2>
       <h3 style="color: #000000;">
        1.1. 简单介绍
       </h3>
       <p style="color: #000000;">
        正则表达式并不是Python的一部分。正则表达式是用于处理字符串的强大工具，拥有自己独特的语法以及一个独立的处理引擎，效率上可能不如str自带的方法，但功能十分强大。得益于这一点，在提供了正则表达式的语言里，正则表达式的语法都是一样的，区别只在于不同的编程语言实现支持的语法数量不同；但不用担心，不被支持的语法通常是不常用的部分。如果已经在其他语言里使用过正则表达式，只需要简单看一看就可以上手了。
       </p>
       <p style="color: #000000;">
        下图展示了使用正则表达式进行匹配的流程：
        <br/>
        <img src="http://images.cnblogs.com/cnblogs_com/huxi/WindowsLiveWriter/Python_10A67/re_simple_38246a58-83be-4adf-9f30-6d735e9b9b47.png"/>
       </p>
       <p style="color: #000000;">
        正则表达式的大致匹配过程是：依次拿出表达式和文本中的字符比较，如果每一个字符都能匹配，则匹配成功；一旦有匹配不成功的字符则匹配失败。如果表达式中有量词或边界，这个过程会稍微有一些不同，但也是很好理解的，看下图中的示例以及自己多使用几次就能明白。
       </p>
       <p style="color: #000000;">
        下图列出了Python支持的正则表达式元字符和语法：
        <br/>
        <img src="http://images.cnblogs.com/cnblogs_com/huxi/Windows-Live-Writer/Python_10A67/pyre_ebb9ce1c-e5e8-4219-a8ae-7ee620d5f9f1.png"/>
       </p>
       <h3 style="color: #000000;">
        1.2. 数量词的贪婪模式与非贪婪模式
       </h3>
       <p style="color: #000000;">
        正则表达式通常用于在文本中查找匹配的字符串。Python里数量词默认是贪婪的（在少数语言里也可能是默认非贪婪），总是尝试匹配尽可能多的字符；非贪婪的则相反，总是尝试匹配尽可能少的字符。例如：正则表达式”ab*”如果用于查找”abbbc”，将找到”abbb”。而如果使用非贪婪的数量词”ab*?”，将找到”a”。
       </p>
       <h3 style="color: #000000;">
        1.3. 反斜杠的困扰
       </h3>
       <p style="color: #000000;">
        与大多数编程语言相同，正则表达式里使用”\”作为转义字符，这就可能造成反斜杠困扰。假如你需要匹配文本中的字符”\”，那么使用编程语言表示的正则表达式里将需要4个反斜杠”\\\\”：前两个和后两个分别用于在编程语言里转义成反斜杠，转换成两个反斜杠后再在正则表达式里转义成一个反斜杠。Python里的原生字符串很好地解决了这个问题，这个例子中的正则表达式可以使用r”\\”表示。同样，匹配一个数字的”\\d”可以写成r”\d”。有了原生字符串，你再也不用担心是不是漏写了反斜杠，写出来的表达式也更直观。
       </p>
       <h3 style="color: #000000;">
        1.4. 匹配模式
       </h3>
       <p style="color: #000000;">
        正则表达式提供了一些可用的匹配模式，比如忽略大小写、多行匹配等，这部分内容将在Pattern类的工厂方法re.compile(pattern[, flags])中一起介绍。
       </p>
       <h2 style="color: #000000;">
        2. re模块
       </h2>
       <h3 style="color: #000000;">
        2.1. 开始使用re
       </h3>
       <p style="color: #000000;">
        Python通过re模块提供对正则表达式的支持。使用re的一般步骤是先将正则表达式的字符串形式编译为Pattern实例，然后使用Pattern实例处理文本并获得匹配结果（一个Match实例），最后使用Match实例获得信息，进行其他的操作。
       </p>
       <div style="color: #000000;">
        <div class="syntaxhighlighter py" id="highlighter_114169">
         <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
           <tr>
            <td class="gutter" style="color: #afafaf !important;">
             <div class="line number1 index0 alt2">
              1
             </div>
             <div class="line number2 index1 alt1">
              2
             </div>
             <div class="line number3 index2 alt2">
              3
             </div>
             <div class="line number4 index3 alt1">
              4
             </div>
             <div class="line number5 index4 alt2">
              5
             </div>
             <div class="line number6 index5 alt1">
              6
             </div>
             <div class="line number7 index6 alt2">
              7
             </div>
             <div class="line number8 index7 alt1">
              8
             </div>
             <div class="line number9 index8 alt2">
              9
             </div>
             <div class="line number10 index9 alt1">
              10
             </div>
             <div class="line number11 index10 alt2">
              11
             </div>
             <div class="line number12 index11 alt1">
              12
             </div>
             <div class="line number13 index12 alt2">
              13
             </div>
             <div class="line number14 index13 alt1">
              14
             </div>
             <div class="line number15 index14 alt2">
              15
             </div>
            </td>
            <td class="code">
             <div class="container">
              <div class="line number1 index0 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # encoding: UTF-8
               </code>
              </div>
              <div class="line number2 index1 alt1">
               <code class="py keyword" style="color: #0000ff !important;">
                import
               </code>
               <code class="py plain">
                re
               </code>
              </div>
              <div class="line number3 index2 alt2">
              </div>
              <div class="line number4 index3 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # 将正则表达式编译成Pattern对象
               </code>
              </div>
              <div class="line number5 index4 alt2">
               <code class="py plain">
                pattern
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.
               </code>
               <code class="py functions" style="color: #ff1493 !important;">
                compile
               </code>
               <code class="py plain">
                (r
               </code>
               <code class="py string" style="color: blue !important;">
                'hello'
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number6 index5 alt1">
              </div>
              <div class="line number7 index6 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # 使用Pattern匹配文本，获得匹配结果，无法匹配时将返回None
               </code>
              </div>
              <div class="line number8 index7 alt1">
               <code class="py plain">
                match
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                pattern.match(
               </code>
               <code class="py string" style="color: blue !important;">
                'hello world!'
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number9 index8 alt2">
              </div>
              <div class="line number10 index9 alt1">
               <code class="py keyword" style="color: #0000ff !important;">
                if
               </code>
               <code class="py plain">
                match:
               </code>
              </div>
              <div class="line number11 index10 alt2">
               <code class="py spaces">
               </code>
               <code class="py comments" style="color: #008200 !important;">
                # 使用Match获得分组信息
               </code>
              </div>
              <div class="line number12 index11 alt1">
               <code class="py spaces">
               </code>
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py plain">
                match.group()
               </code>
              </div>
              <div class="line number13 index12 alt2">
              </div>
              <div class="line number14 index13 alt1">
               <code class="py comments" style="color: #008200 !important;">
                ### 输出 ###
               </code>
              </div>
              <div class="line number15 index14 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # hello
               </code>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p style="color: #000000;">
        <b>
         re.compile(strPattern[, flag]):
        </b>
       </p>
       <p style="color: #000000;">
        这个方法是Pattern类的工厂方法，用于将字符串形式的正则表达式编译为Pattern对象。 第二个参数flag是匹配模式，取值可以使用按位或运算符’|’表示同时生效，比如re.I | re.M。另外，你也可以在regex字符串中指定模式，比如re.compile(‘pattern’, re.I | re.M)与re.compile(‘(?im)pattern’)是等价的。
        <br/>
        可选值有：
       </p>
       <ul style="color: #000000;">
        <li>
         re.
         <b>
          I
         </b>
         (re.IGNORECASE): 忽略大小写（括号内是完整写法，下同）
        </li>
        <li>
         <b>
          M
         </b>
         (MULTILINE): 多行模式，改变’^’和’$’的行为（参见上图）
        </li>
        <li>
         <b>
          S
         </b>
         (DOTALL): 点任意匹配模式，改变’.’的行为
        </li>
        <li>
         <b>
          L
         </b>
         (LOCALE): 使预定字符类 \w \W \b \B \s \S 取决于当前区域设定
        </li>
        <li>
         <b>
          U
         </b>
         (UNICODE): 使预定字符类 \w \W \b \B \s \S \d \D 取决于unicode定义的字符属性
        </li>
        <li>
         <b>
          X
         </b>
         (VERBOSE): 详细模式。这个模式下正则表达式可以是多行，忽略空白字符，并可以加入注释。以下两个正则表达式是等价的：
        </li>
       </ul>
       <div style="color: #000000;">
        <div class="syntaxhighlighter py" id="highlighter_970078">
         <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
           <tr>
            <td class="gutter" style="color: #afafaf !important;">
             <div class="line number1 index0 alt2">
              1
             </div>
             <div class="line number2 index1 alt1">
              2
             </div>
             <div class="line number3 index2 alt2">
              3
             </div>
             <div class="line number4 index3 alt1">
              4
             </div>
            </td>
            <td class="code">
             <div class="container">
              <div class="line number1 index0 alt2">
               <code class="py plain">
                a
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.
               </code>
               <code class="py functions" style="color: #ff1493 !important;">
                compile
               </code>
               <code class="py plain">
                (r
               </code>
               <code class="py comments" style="color: #008200 !important;">
                """\d +  # the integral part
               </code>
              </div>
              <div class="line number2 index1 alt1">
               <code class="py spaces">
               </code>
               <code class="py comments" style="color: #008200 !important;">
                \.    # the decimal point
               </code>
              </div>
              <div class="line number3 index2 alt2">
               <code class="py spaces">
               </code>
               <code class="py comments" style="color: #008200 !important;">
                \d *  # some fractional digits"""
               </code>
               <code class="py plain">
                , re.X)
               </code>
              </div>
              <div class="line number4 index3 alt1">
               <code class="py plain">
                b
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.
               </code>
               <code class="py functions" style="color: #ff1493 !important;">
                compile
               </code>
               <code class="py plain">
                (r
               </code>
               <code class="py string" style="color: blue !important;">
                "\d+\.\d*"
               </code>
               <code class="py plain">
                )
               </code>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p style="color: #000000;">
        re提供了众多模块方法用于完成正则表达式的功能。这些方法可以使用Pattern实例的相应方法替代，唯一的好处是少写一行re.compile()代码，但同时也无法复用编译后的Pattern对象。这些方法将在Pattern类的实例方法部分一起介绍。如上面这个例子可以简写为：
       </p>
       <div style="color: #000000;">
        <div class="syntaxhighlighter py" id="highlighter_20357">
         <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
           <tr>
            <td class="gutter" style="color: #afafaf !important;">
             <div class="line number1 index0 alt2">
              1
             </div>
             <div class="line number2 index1 alt1">
              2
             </div>
            </td>
            <td class="code">
             <div class="container">
              <div class="line number1 index0 alt2">
               <code class="py plain">
                m
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.match(r
               </code>
               <code class="py string" style="color: blue !important;">
                'hello'
               </code>
               <code class="py plain">
                ,
               </code>
               <code class="py string" style="color: blue !important;">
                'hello world!'
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number2 index1 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py plain">
                m.group()
               </code>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p style="color: #000000;">
        re模块还提供了一个方法escape(string)，用于将string中的正则表达式元字符如*/+/?等之前加上转义符再返回，在需要大量匹配元字符时有那么一点用。
       </p>
       <h3 style="color: #000000;">
        2.2. Match
       </h3>
       <p style="color: #000000;">
        Match对象是一次匹配的结果，包含了很多关于此次匹配的信息，可以使用Match提供的可读属性或方法来获取这些信息。
       </p>
       <p style="color: #000000;">
        属性：
       </p>
       <ol style="color: #000000;">
        <li>
         <b>
          string
         </b>
         : 匹配时使用的文本。
        </li>
        <li>
         <b>
          re
         </b>
         : 匹配时使用的Pattern对象。
        </li>
        <li>
         <b>
          pos
         </b>
         : 文本中正则表达式开始搜索的索引。值与Pattern.match()和Pattern.seach()方法的同名参数相同。
        </li>
        <li>
         <b>
          endpos
         </b>
         : 文本中正则表达式结束搜索的索引。值与Pattern.match()和Pattern.seach()方法的同名参数相同。
        </li>
        <li>
         <b>
          lastindex
         </b>
         : 最后一个被捕获的分组在文本中的索引。如果没有被捕获的分组，将为None。
        </li>
        <li>
         <b>
          lastgroup
         </b>
         : 最后一个被捕获的分组的别名。如果这个分组没有别名或者没有被捕获的分组，将为None。
        </li>
       </ol>
       <p style="color: #000000;">
        方法：
       </p>
       <ol style="color: #000000;">
        <li>
         <b>
          group([group1, …]):
         </b>
         <br/>
         获得一个或多个分组截获的字符串；指定多个参数时将以元组形式返回。group1可以使用编号也可以使用别名；编号0代表整个匹配的子串；不填写参数时，返回group(0)；没有截获字符串的组返回None；截获了多次的组返回最后一次截获的子串。
        </li>
        <li>
         <b>
          groups([default]):
         </b>
         <br/>
         以元组形式返回全部分组截获的字符串。相当于调用group(1,2,…last)。default表示没有截获字符串的组以这个值替代，默认为None。
        </li>
        <li>
         <b>
          groupdict([default]):
          <br/>
         </b>
         返回以有别名的组的别名为键、以该组截获的子串为值的字典，没有别名的组不包含在内。default含义同上。
        </li>
        <li>
         <b>
          start([group]):
         </b>
         <br/>
         返回指定的组截获的子串在string中的起始索引（子串第一个字符的索引）。group默认值为0。
        </li>
        <li>
         <b>
          end([group]):
          <br/>
         </b>
         返回指定的组截获的子串在string中的结束索引（子串最后一个字符的索引+1）。group默认值为0。
        </li>
        <li>
         <b>
          span([group]):
          <br/>
         </b>
         返回(start(group), end(group))。
        </li>
        <li>
         <b>
          expand(template):
         </b>
         <br/>
         将匹配到的分组代入template中然后返回。template中可以使用\id或\g&lt;id&gt;、\g&lt;name&gt;引用分组，但不能使用编号0。\id与\g&lt;id&gt;是等价的；但\10将被认为是第10个分组，如果你想表达\1之后是字符’0’，只能使用\g&lt;1&gt;0。
        </li>
       </ol>
       <div style="color: #000000;">
        <div class="syntaxhighlighter py" id="highlighter_175925">
         <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
           <tr>
            <td class="gutter" style="color: #afafaf !important;">
             <div class="line number1 index0 alt2">
              1
             </div>
             <div class="line number2 index1 alt1">
              2
             </div>
             <div class="line number3 index2 alt2">
              3
             </div>
             <div class="line number4 index3 alt1">
              4
             </div>
             <div class="line number5 index4 alt2">
              5
             </div>
             <div class="line number6 index5 alt1">
              6
             </div>
             <div class="line number7 index6 alt2">
              7
             </div>
             <div class="line number8 index7 alt1">
              8
             </div>
             <div class="line number9 index8 alt2">
              9
             </div>
             <div class="line number10 index9 alt1">
              10
             </div>
             <div class="line number11 index10 alt2">
              11
             </div>
             <div class="line number12 index11 alt1">
              12
             </div>
             <div class="line number13 index12 alt2">
              13
             </div>
             <div class="line number14 index13 alt1">
              14
             </div>
             <div class="line number15 index14 alt2">
              15
             </div>
             <div class="line number16 index15 alt1">
              16
             </div>
             <div class="line number17 index16 alt2">
              17
             </div>
             <div class="line number18 index17 alt1">
              18
             </div>
             <div class="line number19 index18 alt2">
              19
             </div>
             <div class="line number20 index19 alt1">
              20
             </div>
             <div class="line number21 index20 alt2">
              21
             </div>
             <div class="line number22 index21 alt1">
              22
             </div>
             <div class="line number23 index22 alt2">
              23
             </div>
             <div class="line number24 index23 alt1">
              24
             </div>
             <div class="line number25 index24 alt2">
              25
             </div>
             <div class="line number26 index25 alt1">
              26
             </div>
             <div class="line number27 index26 alt2">
              27
             </div>
             <div class="line number28 index27 alt1">
              28
             </div>
             <div class="line number29 index28 alt2">
              29
             </div>
             <div class="line number30 index29 alt1">
              30
             </div>
             <div class="line number31 index30 alt2">
              31
             </div>
             <div class="line number32 index31 alt1">
              32
             </div>
            </td>
            <td class="code">
             <div class="container">
              <div class="line number1 index0 alt2">
               <code class="py keyword" style="color: #0000ff !important;">
                import
               </code>
               <code class="py plain">
                re
               </code>
              </div>
              <div class="line number2 index1 alt1">
               <code class="py plain">
                m
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.match(r
               </code>
               <code class="py string" style="color: blue !important;">
                '(\w+) (\w+)(?P&lt;sign&gt;.*)'
               </code>
               <code class="py plain">
                ,
               </code>
               <code class="py string" style="color: blue !important;">
                'hello world!'
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number3 index2 alt2">
              </div>
              <div class="line number4 index3 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.string:"
               </code>
               <code class="py plain">
                , m.string
               </code>
              </div>
              <div class="line number5 index4 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.re:"
               </code>
               <code class="py plain">
                , m.re
               </code>
              </div>
              <div class="line number6 index5 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.pos:"
               </code>
               <code class="py plain">
                , m.pos
               </code>
              </div>
              <div class="line number7 index6 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.endpos:"
               </code>
               <code class="py plain">
                , m.endpos
               </code>
              </div>
              <div class="line number8 index7 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.lastindex:"
               </code>
               <code class="py plain">
                , m.lastindex
               </code>
              </div>
              <div class="line number9 index8 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.lastgroup:"
               </code>
               <code class="py plain">
                , m.lastgroup
               </code>
              </div>
              <div class="line number10 index9 alt1">
              </div>
              <div class="line number11 index10 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.group(1,2):"
               </code>
               <code class="py plain">
                , m.group(
               </code>
               <code class="py value" style="color: #009900 !important;">
                1
               </code>
               <code class="py plain">
                ,
               </code>
               <code class="py value" style="color: #009900 !important;">
                2
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number12 index11 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.groups():"
               </code>
               <code class="py plain">
                , m.groups()
               </code>
              </div>
              <div class="line number13 index12 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.groupdict():"
               </code>
               <code class="py plain">
                , m.groupdict()
               </code>
              </div>
              <div class="line number14 index13 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.start(2):"
               </code>
               <code class="py plain">
                , m.start(
               </code>
               <code class="py value" style="color: #009900 !important;">
                2
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number15 index14 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.end(2):"
               </code>
               <code class="py plain">
                , m.end(
               </code>
               <code class="py value" style="color: #009900 !important;">
                2
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number16 index15 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "m.span(2):"
               </code>
               <code class="py plain">
                , m.span(
               </code>
               <code class="py value" style="color: #009900 !important;">
                2
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number17 index16 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py plain">
                r
               </code>
               <code class="py string" style="color: blue !important;">
                "m.expand(r'\2 \1\3'):"
               </code>
               <code class="py plain">
                , m.expand(r
               </code>
               <code class="py string" style="color: blue !important;">
                '\2 \1\3'
               </code>
               <code class="py plain">
                )
               </code>
              </div>
              <div class="line number18 index17 alt1">
              </div>
              <div class="line number19 index18 alt2">
               <code class="py comments" style="color: #008200 !important;">
                ### output ###
               </code>
              </div>
              <div class="line number20 index19 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.string: hello world!
               </code>
              </div>
              <div class="line number21 index20 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.re: &lt;_sre.SRE_Pattern object at 0x016E1A38&gt;
               </code>
              </div>
              <div class="line number22 index21 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.pos: 0
               </code>
              </div>
              <div class="line number23 index22 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.endpos: 12
               </code>
              </div>
              <div class="line number24 index23 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.lastindex: 3
               </code>
              </div>
              <div class="line number25 index24 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.lastgroup: sign
               </code>
              </div>
              <div class="line number26 index25 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.group(1,2): ('hello', 'world')
               </code>
              </div>
              <div class="line number27 index26 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.groups(): ('hello', 'world', '!')
               </code>
              </div>
              <div class="line number28 index27 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.groupdict(): {'sign': '!'}
               </code>
              </div>
              <div class="line number29 index28 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.start(2): 6
               </code>
              </div>
              <div class="line number30 index29 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.end(2): 11
               </code>
              </div>
              <div class="line number31 index30 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # m.span(2): (6, 11)
               </code>
              </div>
              <div class="line number32 index31 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # m.expand(r'\2 \1\3'): world hello!
               </code>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3 style="color: #000000;">
        2.3. Pattern
       </h3>
       <p style="color: #000000;">
        Pattern对象是一个编译好的正则表达式，通过Pattern提供的一系列方法可以对文本进行匹配查找。
       </p>
       <p style="color: #000000;">
        Pattern不能直接实例化，必须使用re.compile()进行构造。
       </p>
       <p style="color: #000000;">
        Pattern提供了几个可读属性用于获取表达式的相关信息：
       </p>
       <ol style="color: #000000;">
        <li>
         pattern: 编译时用的表达式字符串。
        </li>
        <li>
         flags: 编译时用的匹配模式。数字形式。
        </li>
        <li>
         groups: 表达式中分组的数量。
        </li>
        <li>
         groupindex: 以表达式中有别名的组的别名为键、以该组对应的编号为值的字典，没有别名的组不包含在内。
        </li>
       </ol>
       <div style="color: #000000;">
        <div class="syntaxhighlighter py" id="highlighter_287059">
         <table border="0" cellpadding="0" cellspacing="0">
          <tbody>
           <tr>
            <td class="gutter" style="color: #afafaf !important;">
             <div class="line number1 index0 alt2">
              1
             </div>
             <div class="line number2 index1 alt1">
              2
             </div>
             <div class="line number3 index2 alt2">
              3
             </div>
             <div class="line number4 index3 alt1">
              4
             </div>
             <div class="line number5 index4 alt2">
              5
             </div>
             <div class="line number6 index5 alt1">
              6
             </div>
             <div class="line number7 index6 alt2">
              7
             </div>
             <div class="line number8 index7 alt1">
              8
             </div>
             <div class="line number9 index8 alt2">
              9
             </div>
             <div class="line number10 index9 alt1">
              10
             </div>
             <div class="line number11 index10 alt2">
              11
             </div>
             <div class="line number12 index11 alt1">
              12
             </div>
             <div class="line number13 index12 alt2">
              13
             </div>
            </td>
            <td class="code">
             <div class="container">
              <div class="line number1 index0 alt2">
               <code class="py keyword" style="color: #0000ff !important;">
                import
               </code>
               <code class="py plain">
                re
               </code>
              </div>
              <div class="line number2 index1 alt1">
               <code class="py plain">
                p
               </code>
               <code class="py keyword" style="color: #0000ff !important;">
                =
               </code>
               <code class="py plain">
                re.
               </code>
               <code class="py functions" style="color: #ff1493 !important;">
                compile
               </code>
               <code class="py plain">
                (r
               </code>
               <code class="py string" style="color: blue !important;">
                '(\w+) (\w+)(?P&lt;sign&gt;.*)'
               </code>
               <code class="py plain">
                , re.DOTALL)
               </code>
              </div>
              <div class="line number3 index2 alt2">
              </div>
              <div class="line number4 index3 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "p.pattern:"
               </code>
               <code class="py plain">
                , p.pattern
               </code>
              </div>
              <div class="line number5 index4 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "p.flags:"
               </code>
               <code class="py plain">
                , p.flags
               </code>
              </div>
              <div class="line number6 index5 alt1">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "p.groups:"
               </code>
               <code class="py plain">
                , p.groups
               </code>
              </div>
              <div class="line number7 index6 alt2">
               <code class="py functions" style="color: #ff1493 !important;">
                print
               </code>
               <code class="py string" style="color: blue !important;">
                "p.groupindex:"
               </code>
               <code class="py plain">
                , p.groupindex
               </code>
              </div>
              <div class="line number8 index7 alt1">
              </div>
              <div class="line number9 index8 alt2">
               <code class="py comments" style="color: #008200 !important;">
                ### output ###
               </code>
              </div>
              <div class="line number10 index9 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # p.pattern: (\w+) (\w+)(?P&lt;sign&gt;.*)
               </code>
              </div>
              <div class="line number11 index10 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # p.flags: 16
               </code>
              </div>
              <div class="line number12 index11 alt1">
               <code class="py comments" style="color: #008200 !important;">
                # p.groups: 3
               </code>
              </div>
              <div class="line number13 index12 alt2">
               <code class="py comments" style="color: #008200 !important;">
                # p.groupindex: {'sign': 3}
               </code>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p style="color: #000000;">
        实例方法[ | re模块方法]：
       </p>
       <ol style="color: #000000;">
        <li>
         <b>
          match(string[, pos[, endpos]]) | re.match(pattern, string[, flags]):
          <br/>
         </b>
         这个方法将从string的pos下标处起尝试匹配pattern；如果pattern结束时仍可匹配，则返回一个Match对象；如果匹配过程中pattern无法匹配，或者匹配未结束就已到达endpos，则返回None。
         <br/>
         pos和endpos的默认值分别为0和len(string)；re.match()无法指定这两个参数，参数flags用于编译pattern时指定匹配模式。
         <br/>
         注意：这个方法并不是完全匹配。当pattern结束时若string还有剩余字符，仍然视为成功。想要完全匹配，可以在表达式末尾加上边界匹配符’$’。
         <br/>
         示例参见2.1小节。
        </li>
        <li>
         <b>
          search(string[, pos[, endpos]]) | re.search(pattern, string[, flags]):
          <br/>
         </b>
         这个方法用于查找字符串中可以匹配成功的子串。从string的pos下标处起尝试匹配pattern，如果pattern结束时仍可匹配，则返回一个Match对象；若无法匹配，则将pos加1后重新尝试匹配；直到pos=endpos时仍无法匹配则返回None。
         <br/>
         pos和endpos的默认值分别为0和len(string))；re.search()无法指定这两个参数，参数flags用于编译pattern时指定匹配模式。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_754551">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
               <div class="line number8 index7 alt1">
                8
               </div>
               <div class="line number9 index8 alt2">
                9
               </div>
               <div class="line number10 index9 alt1">
                10
               </div>
               <div class="line number11 index10 alt2">
                11
               </div>
               <div class="line number12 index11 alt1">
                12
               </div>
               <div class="line number13 index12 alt2">
                13
               </div>
               <div class="line number14 index13 alt1">
                14
               </div>
               <div class="line number15 index14 alt2">
                15
               </div>
               <div class="line number16 index15 alt1">
                16
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # encoding: UTF-8
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number3 index2 alt2">
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # 将正则表达式编译成Pattern对象
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                 <code class="py plain">
                  pattern
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'world'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number6 index5 alt1">
                </div>
                <div class="line number7 index6 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # 使用search()查找匹配的子串，不存在能匹配的子串时将返回None
                 </code>
                </div>
                <div class="line number8 index7 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # 这个例子中使用match()无法成功匹配
                 </code>
                </div>
                <div class="line number9 index8 alt2">
                 <code class="py plain">
                  match
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  pattern.search(
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'hello world!'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number10 index9 alt1">
                </div>
                <div class="line number11 index10 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  if
                 </code>
                 <code class="py plain">
                  match:
                 </code>
                </div>
                <div class="line number12 index11 alt1">
                 <code class="py spaces">
                 </code>
                 <code class="py comments" style="color: #008200 !important;">
                  # 使用Match获得分组信息
                 </code>
                </div>
                <div class="line number13 index12 alt2">
                 <code class="py spaces">
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  match.group()
                 </code>
                </div>
                <div class="line number14 index13 alt1">
                </div>
                <div class="line number15 index14 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  ### 输出 ###
                 </code>
                </div>
                <div class="line number16 index15 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # world
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
        <li>
         <b>
          split(string[, maxsplit]) | re.split(pattern, string[, maxsplit]):
          <br/>
         </b>
         按照能够匹配的子串将string分割后返回列表。maxsplit用于指定最大分割次数，不指定将全部分割。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_890764">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                </div>
                <div class="line number3 index2 alt2">
                 <code class="py plain">
                  p
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '\d+'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.split(
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'one1two2three3four4'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                </div>
                <div class="line number6 index5 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  ### output ###
                 </code>
                </div>
                <div class="line number7 index6 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # ['one', 'two', 'three', 'four', '']
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
        <li>
         <b>
          findall(string[, pos[, endpos]]) | re.findall(pattern, string[, flags]):
          <br/>
         </b>
         搜索string，以列表形式返回全部能匹配的子串。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_314891">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                </div>
                <div class="line number3 index2 alt2">
                 <code class="py plain">
                  p
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '\d+'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.findall(
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'one1two2three3four4'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                </div>
                <div class="line number6 index5 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  ### output ###
                 </code>
                </div>
                <div class="line number7 index6 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # ['1', '2', '3', '4']
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
        <li>
         <b>
          finditer(string[, pos[, endpos]]) | re.finditer(pattern, string[, flags]):
          <br/>
         </b>
         搜索string，返回一个顺序访问每一个匹配结果（Match对象）的迭代器。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_692118">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
               <div class="line number8 index7 alt1">
                8
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                </div>
                <div class="line number3 index2 alt2">
                 <code class="py plain">
                  p
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '\d+'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py keyword" style="color: #0000ff !important;">
                  for
                 </code>
                 <code class="py plain">
                  m
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  in
                 </code>
                 <code class="py plain">
                  p.finditer(
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'one1two2three3four4'
                 </code>
                 <code class="py plain">
                  ):
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                 <code class="py spaces">
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  m.group(),
                 </code>
                </div>
                <div class="line number6 index5 alt1">
                </div>
                <div class="line number7 index6 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  ### output ###
                 </code>
                </div>
                <div class="line number8 index7 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # 1 2 3 4
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
        <li>
         <b>
          sub(repl, string[, count]) | re.sub(pattern, repl, string[, count]):
          <br/>
         </b>
         使用repl替换string中每一个匹配的子串后返回替换后的字符串。
         <br/>
         当repl是一个字符串时，可以使用\id或\g&lt;id&gt;、\g&lt;name&gt;引用分组，但不能使用编号0。
         <br/>
         当repl是一个方法时，这个方法应当只接受一个参数（Match对象），并返回一个字符串用于替换（返回的字符串中不能再引用分组）。
         <br/>
         count用于指定最多替换次数，不指定时全部替换。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_852785">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
               <div class="line number8 index7 alt1">
                8
               </div>
               <div class="line number9 index8 alt2">
                9
               </div>
               <div class="line number10 index9 alt1">
                10
               </div>
               <div class="line number11 index10 alt2">
                11
               </div>
               <div class="line number12 index11 alt1">
                12
               </div>
               <div class="line number13 index12 alt2">
                13
               </div>
               <div class="line number14 index13 alt1">
                14
               </div>
               <div class="line number15 index14 alt2">
                15
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                </div>
                <div class="line number3 index2 alt2">
                 <code class="py plain">
                  p
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '(\w+) (\w+)'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py plain">
                  s
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'i say, hello world!'
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                </div>
                <div class="line number6 index5 alt1">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.sub(r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '\2 \1'
                 </code>
                 <code class="py plain">
                  , s)
                 </code>
                </div>
                <div class="line number7 index6 alt2">
                </div>
                <div class="line number8 index7 alt1">
                 <code class="py keyword" style="color: #0000ff !important;">
                  def
                 </code>
                 <code class="py plain">
                  func(m):
                 </code>
                </div>
                <div class="line number9 index8 alt2">
                 <code class="py spaces">
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  return
                 </code>
                 <code class="py plain">
                  m.group(
                 </code>
                 <code class="py value" style="color: #009900 !important;">
                  1
                 </code>
                 <code class="py plain">
                  ).title()
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  +
                 </code>
                 <code class="py string" style="color: blue !important;">
                  ' '
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  +
                 </code>
                 <code class="py plain">
                  m.group(
                 </code>
                 <code class="py value" style="color: #009900 !important;">
                  2
                 </code>
                 <code class="py plain">
                  ).title()
                 </code>
                </div>
                <div class="line number10 index9 alt1">
                </div>
                <div class="line number11 index10 alt2">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.sub(func, s)
                 </code>
                </div>
                <div class="line number12 index11 alt1">
                </div>
                <div class="line number13 index12 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  ### output ###
                 </code>
                </div>
                <div class="line number14 index13 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # say i, world hello!
                 </code>
                </div>
                <div class="line number15 index14 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # I Say, Hello World!
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
        <li>
         <b>
          subn(repl, string[, count]) |re.sub(pattern, repl, string[, count]):
          <br/>
         </b>
         返回 (sub(repl, string[, count]), 替换次数)。
         <p>
         </p>
         <div>
          <div class="syntaxhighlighter py" id="highlighter_235180">
           <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
             <tr>
              <td class="gutter" style="color: #afafaf !important;">
               <div class="line number1 index0 alt2">
                1
               </div>
               <div class="line number2 index1 alt1">
                2
               </div>
               <div class="line number3 index2 alt2">
                3
               </div>
               <div class="line number4 index3 alt1">
                4
               </div>
               <div class="line number5 index4 alt2">
                5
               </div>
               <div class="line number6 index5 alt1">
                6
               </div>
               <div class="line number7 index6 alt2">
                7
               </div>
               <div class="line number8 index7 alt1">
                8
               </div>
               <div class="line number9 index8 alt2">
                9
               </div>
               <div class="line number10 index9 alt1">
                10
               </div>
               <div class="line number11 index10 alt2">
                11
               </div>
               <div class="line number12 index11 alt1">
                12
               </div>
               <div class="line number13 index12 alt2">
                13
               </div>
               <div class="line number14 index13 alt1">
                14
               </div>
               <div class="line number15 index14 alt2">
                15
               </div>
              </td>
              <td class="code">
               <div class="container">
                <div class="line number1 index0 alt2">
                 <code class="py keyword" style="color: #0000ff !important;">
                  import
                 </code>
                 <code class="py plain">
                  re
                 </code>
                </div>
                <div class="line number2 index1 alt1">
                </div>
                <div class="line number3 index2 alt2">
                 <code class="py plain">
                  p
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py plain">
                  re.
                 </code>
                 <code class="py functions" style="color: #ff1493 !important;">
                  compile
                 </code>
                 <code class="py plain">
                  (r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '(\w+) (\w+)'
                 </code>
                 <code class="py plain">
                  )
                 </code>
                </div>
                <div class="line number4 index3 alt1">
                 <code class="py plain">
                  s
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  =
                 </code>
                 <code class="py string" style="color: blue !important;">
                  'i say, hello world!'
                 </code>
                </div>
                <div class="line number5 index4 alt2">
                </div>
                <div class="line number6 index5 alt1">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.subn(r
                 </code>
                 <code class="py string" style="color: blue !important;">
                  '\2 \1'
                 </code>
                 <code class="py plain">
                  , s)
                 </code>
                </div>
                <div class="line number7 index6 alt2">
                </div>
                <div class="line number8 index7 alt1">
                 <code class="py keyword" style="color: #0000ff !important;">
                  def
                 </code>
                 <code class="py plain">
                  func(m):
                 </code>
                </div>
                <div class="line number9 index8 alt2">
                 <code class="py spaces">
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  return
                 </code>
                 <code class="py plain">
                  m.group(
                 </code>
                 <code class="py value" style="color: #009900 !important;">
                  1
                 </code>
                 <code class="py plain">
                  ).title()
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  +
                 </code>
                 <code class="py string" style="color: blue !important;">
                  ' '
                 </code>
                 <code class="py keyword" style="color: #0000ff !important;">
                  +
                 </code>
                 <code class="py plain">
                  m.group(
                 </code>
                 <code class="py value" style="color: #009900 !important;">
                  2
                 </code>
                 <code class="py plain">
                  ).title()
                 </code>
                </div>
                <div class="line number10 index9 alt1">
                </div>
                <div class="line number11 index10 alt2">
                 <code class="py functions" style="color: #ff1493 !important;">
                  print
                 </code>
                 <code class="py plain">
                  p.subn(func, s)
                 </code>
                </div>
                <div class="line number12 index11 alt1">
                </div>
                <div class="line number13 index12 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  ### output ###
                 </code>
                </div>
                <div class="line number14 index13 alt1">
                 <code class="py comments" style="color: #008200 !important;">
                  # ('say i, world hello!', 2)
                 </code>
                </div>
                <div class="line number15 index14 alt2">
                 <code class="py comments" style="color: #008200 !important;">
                  # ('I Say, Hello World!', 2)
                 </code>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </li>
       </ol>
       <p style="color: #000000;">
        <b>
         以上就是Python对于正则表达式的支持。熟练掌握正则表达式是每一个程序员必须具备的技能，这年头没有不与字符串打交道的程序了。笔者也处于初级阶段，与君共勉，^_^
        </b>
       </p>
       <p style="color: #000000;">
        <strong>
         另外，图中的特殊构造部分没有举出例子，用到这些的正则表达式是具有一定难度的。有兴趣可以思考一下，如何匹配不是以abc开头的单词，^_^
        </strong>
       </p>
       <p style="color: #000000;">
        <b>
         全文结束
        </b>
       </p>
       <p style="color: #000000;">
        原文链接：http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24678.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/20140917125452915416-216x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24678.html" rel="bookmark" title="python3中的正则模块">
         python3中的正则模块
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24675.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/t015b337bd75d9ef893-161x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24675.html" rel="bookmark" title="注释是恶魔，请不要再写一行注释">
         注释是恶魔，请不要再写一行注释
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24660.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/u16130037972892789947fm21gp0-300x157.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24660.html" rel="bookmark" title="如何从Github上轻松安装R包">
         如何从Github上轻松安装R包
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24654.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/df53fac99fc53ba5a90666abcca25e6d_b-267x200.png"/>
        </a>
        <a class="link" href="http://dataunion.org/24654.html" rel="bookmark" title="简单形象又有趣地说说强大的神经网络">
         简单形象又有趣地说说强大的神经网络
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F563.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/563.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/563.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>